<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 联系人</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <style>
        body{padding: 20px;}
        .demo-input{padding-left: 10px; height: 38px; min-width: 262px; line-height: 38px; border: 1px solid #e6e6e6;  background-color: #fff;  border-radius: 2px;}
        .bt_backcolor{
            background-color: gray;
        }
        .bt_backcolor:hover{
            background-color: gray!important;
        }
       .limit{
           background-color: gray;
           color: white;
           border-radius: 16px;
       }
    </style>
</head>
<include file="Admin@Index:cache" />
<body class="gray-bg contacts" oncopy="copyval()">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
            <div class="ibox">
                <div class="ibox-content">
                    <h5>用户列表-
                        <small>已通过用户</small>
                    </h5>
                    <div class="col-sm-12" style="margin-bottom: 1rem">
                        <form role="form" id="my_form" action="__MODULE__/User/user_list_pass" method="get">
                            <div class="form-group">
                                <input type="text" id="content" placeholder="" name="key" class="form-control" value="<{$search.key}>">
                            </div>

                            <div>
                                <label>申请时间</label>
                                <input style="height: 2.5rem;padding: 3px" type="text" class="demo-input" placeholder="选择时间" id="application_time" name="application_time" value="<{$search.application_time}>">
                                <label style="margin-left: 10px">审核时间</label>
                                <input style="height: 2.5rem;padding: 3px" type="text" class="demo-input"  placeholder="选择时间" id="cert_time" name="cert_time" value="<{$search.cert_time}>">
                                <select class="form-control m-b" name="channel"  id="select_channel" style="margin: 0px 10px 0px 10px;padding-top: 3px;display: inline;width: 11%;" >
                                    <option value="">渠道商</option>
                                    <!--<option value="0">自增</option>-->
                                    <volist name="channel" id="vo">
                                        <option value="<{$vo.chan_id}>" ><{$vo.channel_name}></option>
                                    </volist>
                                </select>
                                <span>每页显示</span>
                                <select onchange="submit_form()" class="form-control m-b" name="show_num"  id="show_num" style="margin-bottom: 0;padding-top: 3px;display: inline;width: 11%;" >
                                    <option value="10">10</option>
                                    <option value="20">20</option>
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                </select>
                                <span>条</span>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit" id="search"><strong>搜索</strong>
                                </button>
                            </div>
                        </form>
                    </div>
                    <br>
                    <div class="ibox-content">
                    <table class="table table-striped table-hover" id="sample-table">
                        <tbody>
                        <tr>
                            <th>用户手机号</th>
                            <th>用户姓名</th>
                            <th>审核人</th>
                            <th>审核时间</th>
                            <th>申请时间</th>
                            <th>状态</th>
                            <th>渠道</th>
                            <th>操作</th>
                        </tr>
                        <volist name="data" id="vo">
                            <tr>
                                <td><{$vo.mobile}></td>
                                <td><{$vo.username}></td>
                                <td><{$vo.approver}></td>
                                <td><{$vo.approve_time}></td>
                                <td><{$vo.commit_time}></td>
                                <td id="<{$vo.id}>"><{$vo.approve_state}></td>
                                <td><{$vo.channel_name}></td>
                                <td id="th_<{$vo.id}>">
                                    <a target="_blank" class="btn btn-success btn-rounded"
                                       href="javascript:;" onclick="into_detail('<{$vo.id}>')"
                                       title="详情">详情</a>
                                             <if condition="$vo.borrow_status eq 0">
                                                 <a class="btn btn-info btn-rounded" id="<{$vo.mobile}>"
                                                    href="javascript:;" title="限制借款" onclick="limit_borrow('<{$vo.id}>','<{$vo.mobile}>','<{$vo.borrow_status}>')"
                                                    target="_blank">限制借款</a>
                                                <else/>
                                                 <a class="btn  limit " id="<{$vo.mobile}>"
                                                    href="javascript:;" title="取消限制" onclick="limit_borrow('<{$vo.id}>','<{$vo.mobile}>','<{$vo.borrow_status}>')"
                                                    target="_blank">取消限制</a>
                                             </if>


                                </td>
                            </tr>
                        </volist>
                        </tbody>
                    </table>
                        </div>
                    <ul class="pagination">
                            <{$fpage}>
                    </ul>
                </div>
            </div>
        </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/admin/js/laydate/laydate.js"></script>
<script src="__PUBLIC__/admin/js/layer/layer.js"></script>
<script src="__PUBLIC__/admin/js/layui/layui.js"></script>


<script>
    function submit_form() {
        var form = document.getElementById('my_form');
        form.submit();
    }
    //select赋值
    var option2="<{$search.show_num}>";
    $('#show_num').val(option2);
    //select赋值
    var option="<{$search.channel}>";
    $('#select_channel').val(option);

    //限制借款
    function limit_borrow(id,mobile,status){
    var title='';
        if(status=='5'){
            title ='  将取消手机号码为：'+mobile+"的用户的限制, 是否继续?";
        }else {
            title ='手机号码为：'+mobile+"的用户将被限制借款,还要继续吗？";
        }
        layer.confirm(title, function (index) {
            layer.close(index);
            $.post('__MODULE__/User/limit_borrow', {
                    id: id,status:status,type:1
                },
                function (data) {
                    if (data.code == '1001') {
//                        var tr_id='#'+id;
//                        var bt_id='#'+mobile;
//                        var val=data.b_status;
//                        var bt_val=data.button_status;
//                        $(tr_id).html(val);
//                        $(bt_id).html(bt_val);
//                        layer.msg(data.result, {icon: 6, time: 1000});
                        window.location.reload();
                    } else if (data.code == '1002') {
                        layer.msg(data.result, {icon: 5, time: 1000});
                    }
                }, 'json');
        });



    }
    //个人详情
    function into_detail(id) {
        layer.load(4);
        window.location.href='__MODULE__/User/user_detail?u_id='+id;

        $.post('__MODULE__/User/user_detail', {u_id:id}, function (data) {
            layer.closeAll('loading');
        });
    }
    //日期时间范围
    laydate.render({
        elem: '#application_time'
        ,type: 'datetime'
        ,range: true
    });
    //日期时间范围
    laydate.render({
        elem: '#cert_time'
        ,type: 'datetime'
        ,range: true
    });



    function copyval() {
//        event.returnValue = false;
        var content ='【已通过用户】列表复制：'+ window.getSelection().toString();
        $.post('__MODULE__/Mypublic/copy_all', {content:content}, function (data) {
            if (data.code == '1001') {
            } else {
                console.log(data);
            }
        });
//        console.log(content)
    }


    $(document).ready(function () {
        $('.fancybox').fancybox({
            openEffect: 'none',
            closeEffect: 'none'
        });
    });


</script>

</body>

</html>
